#ifndef FUNCTION_H
#define FUNCTION_H

class Function {
public:
    virtual double operator() (double x,double y) const = 0;
    virtual double derivative_x(double x,double y) const {
        const double h = 1e-5;
        return ((*this)(x + h,y) - (*this)(x - h,y)) / (2 * h);
    }
    virtual double derivative_y(double x,double y) const {
        const double h = 1e-5;
        return ((*this)(x,y+h) - (*this)(x,y-h)) / (2 * h);
    }
    virtual ~Function() = default;
};

#endif 